﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WCFCliente;

public partial class login : System.Web.UI.Page
{
    protected WCFCliente.WCFClienteClient wcfCliente = new WCFCliente.WCFClienteClient();

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["nome"] != null) {
            Response.Redirect("viagens.aspx");
        }
    }
    protected void Button1_Click1(object sender, EventArgs e)
    {
        try
        {
            Cliente cliente = new Cliente();
            cliente = wcfCliente.getByPassaporte(passaporte.Text);
            Session["id"] = cliente.IDCliente;
            Session["nome"] = cliente.nome;
            Response.Redirect("viagens.aspx");

        }
        catch (Exception)
        {
            err.InnerHtml = "Dados incorrectos!";
        }
    }
}